Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/setec: be more deliberate about whitespace in text values #108

Merged
merged 2 commits into from
May 1, 2024

Conversation

creachadair
Copy link
Member

Previously we added the --verbatim flag to override the default removal of
whitespace from plaintext secret values. I have now repeatedly tripped over
forgetting this default on PEM-formatted key values, so I propose we make it
harder to commit that error.

This change refines the check: If a value is not UTF-8, or does not have
leading or trailing whitespace, it is processed verbatim as before.

Now, however, if a UTF-8 value has leading or trailing whitespace, the user
must explicitly say what to do: Either set --verbatim to keep it, or set the
new --trim-space flag to remove it. Failing to set either flag reports an error
so the user does not get surprised.

Previously we added the --verbatim flag to override the default removal of
whitespace from plaintext secret values. I have now repeatedly tripped over
forgetting this default on PEM-formatted key values, so I propose we make it
harder to commit that error.

This change refines the check: If a value is not UTF-8, or does not have
leading or trailing whitespace, it is processed verbatim as before.

Now, however, if a UTF-8 value has leading or trailing whitespace, the user
must explicitly say what to do: Either set --verbatim to keep it, or set the
new --trim-space flag to remove it. Failing to set either flag reports an error
so the user does not get surprised.
@creachadair creachadair requested review from danderson and fylie April 30, 2024 22:16
@creachadair creachadair merged commit 45231cc into main May 1, 2024
1 check passed
@creachadair creachadair deleted the mjf/footgun branch May 1, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants